cmake_minimum_required(VERSION 2.8)

PROJECT (ngl)

IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")

set(CMAKE_CXX_STANDARD 20)

IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_CXX_FLAGS "${COLLECT_GCC} -std=c++20 -march=native -msse4.1 -O3 -lrt -L/usr/lib64/mysql/ -lcurl -L/usr/lib64/ -L/usr/lib64/protocol -L`pwd`/../../../lib -I/usr/include/mysql -I/usr/include/curl -I/usr/include/x86_64-linux-gnu/curl -L/usr/lib/x86_64-linux-gnu/ -I/usr/include -I/usr/include/protobuf -L/usr/local/lib/ -I/usr/local/include -I/usr/local/include/google/protobuf -lmysqlclient")
INCLUDE_DIRECTORIES(3part/boost/libs/atomic/src)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")

IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)

INCLUDE_DIRECTORIES(/)
INCLUDE_DIRECTORIES(3part)
INCLUDE_DIRECTORIES(3part/boost)
INCLUDE_DIRECTORIES(3part/asio)
INCLUDE_DIRECTORIES(3part/asio/include)
INCLUDE_DIRECTORIES(3part/curl/)
INCLUDE_DIRECTORIES(3part/curl/include/curl)
INCLUDE_DIRECTORIES(3part/curl/include)
INCLUDE_DIRECTORIES(3part/curl/include)
INCLUDE_DIRECTORIES(3part/curl/openssl)
INCLUDE_DIRECTORIES(3part/mysql/)
INCLUDE_DIRECTORIES(3part/mysql/include)
INCLUDE_DIRECTORIES(3part/protobuf/include)
INCLUDE_DIRECTORIES(3part/protobuf/include/google)
INCLUDE_DIRECTORIES(public/)
INCLUDE_DIRECTORIES(public/cpp)
INCLUDE_DIRECTORIES(public/cpp/net/)
INCLUDE_DIRECTORIES(public/cpp/net/tcp)
INCLUDE_DIRECTORIES(public/cpp/net/udp)
INCLUDE_DIRECTORIES(public/cpp/net/udp/asio_kcp)
INCLUDE_DIRECTORIES(public/cpp/net/udp/kcp)
INCLUDE_DIRECTORIES(public/cpp/protocol/)
INCLUDE_DIRECTORIES(public/cpp/protocol/protocol/)
INCLUDE_DIRECTORIES(public/cpp/protocol/protobuf/)
INCLUDE_DIRECTORIES(public/cpp/protocol/protobuf/lua)
INCLUDE_DIRECTORIES(public/cpp/actor/)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_base)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/game/)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/gateway/)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/login/)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/robot/)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/world)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/log)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/cross)
INCLUDE_DIRECTORIES(public/cpp/actor/actor_logic/reloadcsv)
INCLUDE_DIRECTORIES(public/cpp/tools/)
INCLUDE_DIRECTORIES(public/cpp/tools/serialize/)
INCLUDE_DIRECTORIES(public/cpp/tools/tab/)
INCLUDE_DIRECTORIES(public/cpp/tools/tab/csv/)
INCLUDE_DIRECTORIES(public/cpp/tools/tab/csv/protocol)
INCLUDE_DIRECTORIES(public/cpp/tools/tab/xml/)
INCLUDE_DIRECTORIES(public/cpp/tools/tab/json/)
INCLUDE_DIRECTORIES(public/cpp/tools/db/)
INCLUDE_DIRECTORIES(public/cpp/tools/db/mysql/)
INCLUDE_DIRECTORIES(public/cpp/tools/db/redis/)
INCLUDE_DIRECTORIES(public/cpp/tools/db/shared_memory/)
INCLUDE_DIRECTORIES(public/cpp/tools/dmp/)
INCLUDE_DIRECTORIES(public/cpp/tools/curl/)
INCLUDE_DIRECTORIES(public/cpp/tools/curl/curl)
INCLUDE_DIRECTORIES(public/cpp/tools/curl/curl/include)
INCLUDE_DIRECTORIES(public/cpp/tools/curl/curl/src)
INCLUDE_DIRECTORIES(public/cpp/tools/curl/curl/src/macos/src)
INCLUDE_DIRECTORIES(public/cpp/tools/log/)
INCLUDE_DIRECTORIES(public/cpp/tools/luatools/)
INCLUDE_DIRECTORIES(public/cpp/tools/notify/)
INCLUDE_DIRECTORIES(public/cpp/tools/uuid/)


INCLUDE_DIRECTORIES(public/cpp/logic/)
INCLUDE_DIRECTORIES(public/cpp/logic/public)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role/attribute)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role/bag)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role/task)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role/map)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role/matching)
INCLUDE_DIRECTORIES(public/cpp/logic/public/role/plays)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/notice)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/gm)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/mail)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/chat)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/activity)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/activity/real_activity)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/ranklist)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/brief)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/calendar)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/keyvalue)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/family)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/friend)
INCLUDE_DIRECTORIES(public/cpp/logic/public/public/events)
INCLUDE_DIRECTORIES(public/cpp/logic/public/template_tab)
INCLUDE_DIRECTORIES(public/cpp/logic/tools)

INCLUDE_DIRECTORIES(public/cpp/third_party)
INCLUDE_DIRECTORIES(public/cpp/third_party/asio)
INCLUDE_DIRECTORIES(public/cpp/third_party/asio/include)
INCLUDE_DIRECTORIES(public/cpp/third_party/kcp)
INCLUDE_DIRECTORIES(public/cpp/third_party/tinyxml2)
INCLUDE_DIRECTORIES(public/cpp/third_party/base64)
INCLUDE_DIRECTORIES(public/cpp/third_party/varint)
INCLUDE_DIRECTORIES(public/cpp/third_party/json)
INCLUDE_DIRECTORIES(public/cpp/third_party/redis)
INCLUDE_DIRECTORIES(public/cpp/third_party/sha1)
INCLUDE_DIRECTORIES(public/cpp/third_party/dmp)
INCLUDE_DIRECTORIES(public/cpp/third_party/hmac_sha1)

ADD_DEFINITIONS(-DASIO_STANDALONE)
#ADD_DEFINITIONS(-DASIO_NO_DEPRECATED)
ADD_DEFINITIONS(-D_WEBSOCKETPP_CPP11_TYPE_TRAITS_)
ADD_DEFINITIONS(-DUSE_BOOST_INTERPROCESS)


IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
	ADD_DEFINITIONS(-DBOOST_ALL_NO_LIB)
	ADD_DEFINITIONS(-DBOOST_THREAD_BUILD_DLL)
	ADD_DEFINITIONS(-DBUILDING_LIBCURL)
	ADD_DEFINITIONS(-DHTTP_ONLY)
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")

IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
	ADD_DEFINITIONS(-DBOOST_HAS_PTHREADS)
	ADD_DEFINITIONS(-DBOOST_SP_USE_PTHREADS)
	ADD_DEFINITIONS(-DBOOST_AC_USE_PTHREADS)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")

IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")

IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
	LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib/Debug)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")

IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
	#add_subdirectory(3part)
	add_subdirectory(public)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")

add_subdirectory(server)